package andy.ham;

import andy.ham.db.gen.LoginDao;
import java.util.List;

import andy.ham.NoteDao;
import de.greenrobot.dao.query.QueryBuilder;

/**
 * Created by hy on 2018/6/19.
 */

public class NoteDaoHelper {
    static private NoteDao ld;
    static private List<Note> list;
    public NoteDaoHelper(NoteDao ld) {
        this.ld = ld;

    }

    public Long select() {
        return ld.queryBuilder().count();
    }
    public static List<Note> searchByKey(String key){
       QueryBuilder qb = ld.queryBuilder();
       qb.where(qb.or(NoteDao.Properties.Title.like("%"+key+"%"), NoteDao.Properties.Body.like("%"+key+"%")));
        return qb.list();
    }
}
